<?php

namespace builder\test\controllers;

use builder\base\BaseController;
use builder\card\CardBuilder;
use builder\helper\H5;

/**
 * Card构建器
 */
class CardController extends BaseController
{
    public $actionVerbs = [
        'index' => ['GET', 'POST'],
    ];
    public $publicActions = [
        'index',
    ];

    //卡片构建器示例
    public function actionIndex()
    {
        $cardBuilder = CardBuilder::instance(['id' => 'Ymtest_Card_Index']);
        $cardBuilder->setTitle('Card')
            ->setPartial(!!@$this->get['_partial'])
            ->setCardItem([
                $this->cardItem->panel()->help('注意：这是个普通面板，基于Layui。')->comment('这是一段注释')->body('这是Panel内容')->layout(2)->uiClass('mx-2 my-3'),
                $this->cardItem->panel()->help('注意：这是个普通面板，基于Layui。')->comment('这是一段注释')->body('这是Panel内容')->layout(2)->uiClass('mx-2 my-3'),
                $this->cardItem->panel()->help('注意：这是个普通面板，基于Layui。')->comment('这是一段注释')->body('这是Panel内容')->layout(2)->uiClass('mx-2 my-3'),
                $this->cardItem->panel()->help('注意：这是个普通面板，基于Layui。')->comment('这是一段注释')->body('这是Panel内容')->layout(2)->uiClass('mx-2 my-3'),
                $this->cardItem->panel()->help('注意：这是个普通面板，基于Layui。')->comment('这是一段注释')->body('这是Panel内容')->layout(2)->uiClass('mx-2 my-3'),
                $this->cardItem->panel()->help('注意：这是个普通面板，基于Layui。')->comment('这是一段注释')->body('这是Panel内容')->layout(2)->uiClass('mx-2 my-3'),

                $this->cardItem->card()->help('注意：这是个卡片面板，基于Layui。')->comment('这是一段注释')->header('Card 1')->body(function () {
                    return H5::text('这是卡片内容', ['class' => 'p-3'], 'div');
                })->layout(2)->uiClass('layui-border shadow-sm mx-2 my-3'),
                $this->cardItem->card()->help('注意：这是个卡片面板，基于Layui。')->comment('这是一段注释')->header('Card 2')->body(function () {
                    return H5::text('这是卡片内容', ['class' => 'p-3'], 'div');
                })->layout(2)->uiClass('layui-border shadow-sm mx-2 my-3'),
                $this->cardItem->card()->help('注意：这是个卡片面板，基于Layui。')->comment('这是一段注释')->header('Card 3')->body(function () {
                    return H5::text('这是卡片内容', ['class' => 'p-3'], 'div');
                })->layout(2)->uiClass('layui-border shadow-sm mx-2 my-3'),
                $this->cardItem->card()->help('注意：这是个卡片面板，基于Layui。')->comment('这是一段注释')->header('Card 4')->body(function () {
                    return H5::text('这是卡片内容', ['class' => 'p-3'], 'div');
                })->layout(2)->uiClass('layui-border shadow-sm mx-2 my-3'),
                $this->cardItem->card()->help('注意：这是个卡片面板，基于Layui。')->comment('这是一段注释')->header('Card 5')->body(function () {
                    return H5::text('这是卡片内容', ['class' => 'p-3'], 'div');
                })->layout(2)->uiClass('layui-border shadow-sm mx-2 my-3'),
                $this->cardItem->card()->help('注意：这是个卡片面板，基于Layui。')->comment('这是一段注释')->header('Card 6')->body(function () {
                    return H5::text('这是卡片内容', ['class' => 'p-3'], 'div');
                })->layout(2)->uiClass('layui-border shadow-sm mx-2 my-3'),
            ]);

        return $cardBuilder->render();
    }
}